package cn.edu.scau.cmi.xuandingcong.abstractFactory;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea;

public class AbstractFactoryDomain {
	
	@FXML
	private ComboBox cb1;
	@FXML
	private ComboBox cb2;
	@FXML
	private TextArea ta;
	@FXML
	private Button b;
	
	AonongBeef Aonongbeef = new AonongBeef();
	AonongChicken Aonongchicken = new AonongChicken();
	AonongPork Aonongpork = new AonongPork();
	
	WenshiBeef Wenshibeef = new WenshiBeef();
	WenshiChicken Wenshichicken = new WenshiChicken();
	WenshiPork Wenshipork = new WenshiPork();
	
	TianbangBeef Tianbangbeef = new TianbangBeef();
	TianbangChicken Tianbangchicken = new TianbangChicken();
	TianbangPork Tianbangpork = new TianbangPork();
	
	public void abstractFactoryDomain() {
		b.setOnAction(new EventHandler<ActionEvent>() {
			
			@Override
			public void handle(ActionEvent arg0) {
				// TODO Auto-generated method stub
				if(cb1.getValue().equals("温氏")) {
					if(cb2.getValue().equals("猪肉")) {
						ta.appendText("温氏工厂："+Wenshipork.getWenshiInfo().Operation()+"\n");
					}
					if(cb2.getValue().equals("牛肉")) {
						ta.appendText("温氏工厂："+Wenshichicken.getWenshiInfo().Operation()+"\n");
					}
					if(cb2.getValue().equals("鸡肉")) {
						ta.appendText("温氏工厂："+Wenshibeef.getWenshiInfo().Operation()+"\n");
					}
				}
				if(cb1.getValue().equals("天邦")) {
					if(cb2.getValue().equals("猪肉")) {
						ta.appendText("天邦工厂："+Tianbangpork.getTianbangInfo().Operation()+"\n");
					}
					if(cb2.getValue().equals("牛肉")) {
						ta.appendText("天邦工厂："+Tianbangbeef.getTianbangInfo().Operation()+"\n");
					}
					if(cb2.getValue().equals("鸡肉")) {
						ta.appendText("天邦工厂："+Tianbangchicken.getTianbangInfo().Operation()+"\n");
					}
				}
				if(cb1.getValue().equals("傲农")) {
					if(cb2.getValue().equals("猪肉")) {
						ta.appendText("傲农工厂："+Aonongpork.getAonongInfo().Operation()+"\n");
					}
					if(cb2.getValue().equals("牛肉")) {
						ta.appendText("傲农工厂："+Aonongbeef.getAonongInfo().Operation()+"\n");
					}
					if(cb2.getValue().equals("鸡肉")) {
						ta.appendText("傲农工厂："+Aonongchicken.getAonongInfo().Operation()+"\n");
					}
				}
			}
		});
	}

}
